<?php
/**
 * Created by PhpStorm.
 * User: W
 * Date: 2018/12/20
 * Time: 10:18
 */

namespace app\sports_admin\model;


use think\Model;
use think\Request;

class Cat extends Model
{
    protected  $table = "cat";
    protected  $id    = "cat_id";
    protected $autoWriteTimestamp = true;
    //删除类别信息
    public static function deleteTypeInfo()
    {
        $data = Request::instance()->only('id');
        return self::where('cat_id',$data['id'])->delete();
    }
    //变更类别信息
    public static function updateTypeInfo()
    {
        $data = Request::instance()->only('id,cat_name');
        return self::where('cat_id',$data['id'])->update(['cat_name'=>$data['cat_name']]);
    }
    //添加类别信息
    public static function addTypeInfo()
    {
        $data = Request::instance()->only("cat_name");
        return self::create($data);
    }
}